/*
    This file is part of ciberRatoToolsSrc.

    Copyright (C) 2001-2006 Universidade de Aveiro

    ciberRatoToolsSrc is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    ciberRatoToolsSrc is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

#ifndef CRQCONTROLPANEL_H
#define CRQCONTROLPANEL_H

#include <qvariant.h>
#include <qevent.h>
#include <qwidget.h>
#include"crqcomm.h"

class CRQComm;
class QVBoxLayout; 
class QHBoxLayout; 
class QGridLayout; 
class QFrame;
class QLabel;
class QPushButton;
class QSpinBox;

/*!\class CRQControlPanel
 * \brief This class implements one window with tree buttons to send commands
 * to simulator.
 * The window is one simple widget with buttons and one spinbox to select 
 * the robot to remove.
 */

class CRQControlPanel : public QWidget
{ 
    Q_OBJECT

public:
/*!\brief This is the constructor of the window.
 * All objects are here built.
 */
    CRQControlPanel( CRQCanvas *comCanvas, CRQComm *comm, QString, char,
	  QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );

/*!\brief This is the destructor!
 */
    ~CRQControlPanel();

	void skin(QString skinFileName);

/*!\sa <a href="../Qt_html/qframe.html"> QFrame </a>
 */
    QFrame* linhaHcp;

/*!Button to send one message to the simulator to end the simulation. 
 * \sa <a href="../Qt_html/qpushbutton.html"> QPushButton </a>
 */
    QPushButton* stopButton;

/*!Button to send one message to the simulator to begin the simulation.
 * \sa <a href="../Qt_html/qpushbutton.html"> QPushButton </a>
 */
    QPushButton* startButton;

/*!The text present in the widget.
 * \sa <a href="../Qt_html/qlabel.html> QLabel </a>
 */
    QLabel* controlPanelText;

/*!\sa <a href="../Qt_html/qframe.html"> QFrame </a>
 */
    QFrame* linhaVcp;

/*!Object to select the robot to remove.
 * \sa <a href="../Qt_html/qspinbox.html"> QSPinBox </a>
 */
    QSpinBox* spinRobots;

/*!Button to send one message to the simulator, to remove the selected robot.
 * \sa <a href="../Qt_html/qpushbutton.html"> QPushButton </a>
 */
    QPushButton* removeButton;

	char sound;

protected:
	/*! Event used to capture the mouse click in the window close button
	 */
    bool event( QEvent* );
private:
	/*! Function reimplemented to avoid the destructive close and the closing
	 * event.
	 */
	void closeEvent( QCloseEvent *);
	CRQComm *controlComm;
	char startFile[64];
	char stopFile[64];
	char removeFile[64];
	char backFile[64];
public slots:
/*! This function construct the XML message to send to the simulator in order to
 * stop the simulation.
 */
	void stop( void );

/*! This function construct the XML message to send to the simulator in order to
 * start the simulation.
 */
	void start( void );

/*! This function construct the XML message to send to the simulator in order to
 * remove the selected robot.
 */
	void remove( void );
};

#endif // CRQCONTROLPANEL_H
